﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yule8xCommon.Applib;
using Yule8xModel;

namespace Yule8xWechat.Test
{
    public partial class WHJindou : System.Web.UI.Page
    {
        int game_id, game_currency_number;
        protected void Page_Load(object sender, EventArgs e)
        {
            game_id = ConvertInt(tb_gameid.Text);
            game_currency_number = ConvertInt(tb_jindou.Text);
        }

        protected void btn_save_Click(object sender, EventArgs e)
        {
            string return_msg;
            GameUserInfoModel wanghuuser = WanghuGameUtil.GetGameUserInfo(game_id);
            if(WanghuGameUtil.UpdateYouxidou(wanghuuser.UserID, wanghuuser.Accounts, game_currency_number, out return_msg))
            {
                Response.Redirect("WHJindou.aspx?success");
            }else
            {
                Response.Redirect("WHJindou.aspx?fail");
            }
        }
        int ConvertInt(string value)
        {
            int iout;
            return int.TryParse(value, out iout) ? iout : 0;
        }
    }
}